package com.yangxk.kadmin.web.common.enumeration;

import com.yangxk.kadmin.common.enumeration.BaseExceptionEnum;

/**
 * 业务异常
 *
 * @author yangxk
 * @date 2018/9/13 14:02
 */
public enum ResponseCode implements BaseExceptionEnum {

    ILLEGAL_PARAM(1001, "参数非法"),
    REQUEST_BAD(1002, "请求错误"),
    NEED_LOGIN(1003, "需要登录"),
    NO_PERMISSION(1004, "无权限操作"),
    UPDATE_CHECK_NULL(1005, "待更新对象不存在"),
    SELECT_CHECK_NULL(1006, "查询对象不存在"),
    ILLEGAL_OPERATE(1007, "非法操作"),
    UPLOAD_ERROR(1008, "上传失败"),
    ACCESS_LIMIT(1009, "访问频繁, 请稍后再试"),
    NOT_SUPPORT_REQUEST_METHOD(10010, "请求方法不支持"),
    NO_REQUEST_URL(10011, "请求地址不存在"),

    LOGIN_FAIL(2001, "用户名或密码错误"),
    LOGIN_ACCOUNT_DISABLE(2002, "账号被禁用,请联系管理员"),
    PHONE_EXIST(2003, "手机号已存在"),
    EMAIL_EXIST(2004, "邮箱已存在"),
    OLD_PASSWORD_ERROR(2005, "原密码错误"),

    NOT_SUPPORT_COMPOSITE_KEY(3001, "不支持联合主键"),
    NOT_SUPPORT_PK_AUTOINCREMENT(3002, "不支持主键列自增"),
    NOT_SUPPORT_COLUMN_TYPE(3003, "不支持的列类型"),
    GEN_LOG_RESET_REPEAT(3004, "该记录已被撤销, 无法再次撤销"),

    DELETE_ROLE_FAIL(4001, "该角色还有用户关联, 无法删除"),

    DEPT_DISABLED(5001, "上级部门停用, 不允许新增");


    private int code;
    private String message;

    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }


    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
